package com.example.practical_training_projects.mapper;

import com.example.practical_training_projects.entity.test3;
import com.example.practical_training_projects.vo.votest3class;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface test3Mapper {
    @Select("select * from test3")
    List<test3> getAlltest3();

    @Delete("delete from test3 where t3_uid=#{t3_uid}")
    Integer deleteTest3(Integer t3_uid);
    @Insert("insert into test3 (t3_context,t3_answer1,t3_answer2,ts_uid)"+
            " values (#{t3_context},#{t3_answer1},#{t3_answer2},#{ts_uid})")
    Integer insertTest3(test3 t3_uid);

    @Select("select * from test3 where t3_uid = #{t3_uid}")
    test3 findTest3uid(Integer t3_uid);

    @Update("update test3 set t3_context=#{t3_context},t3_answer1=#{t3_answer1},t3_answer2=#{t3_answer2},ts_uid=#{ts_uid} where t3_uid = #{t3_uid}")
    Integer updateTest3(test3 test3);

    @Select("select *from test3 where t3_context like '%${name}%'")
    List<test3>  getContest3(String t3_context);

//    @Select("select *from test where t_class like '%${name}%'")
//    List<test3>  getClass(String t_class);

    @Select("select t3.*,ts.ts_class from test3 t3 join testselect ts on t3.ts_uid = ts.ts_uid  order by t3_uid desc\n")
    List<votest3class> findAlltest3Andclass();

    @Select("select t3.*,ts.ts_class from test3 t3 join testselect ts on t3.ts_uid = ts.ts_uid where t3.t3_context like '%${name}%' ")
    List<votest3class> findtest3Bycontext(String t3_context);
    @Select("select t3.*,ts.ts_class from test3 t3 join testselect ts on t3.ts_uid = ts.ts_uid where t3.t3_context like '%${t3_context}%'\n" +
            " and ts.ts_uid like '%${ts_uid}%'")
    List<votest3class> findtest3BycontextAndclassuid(@Param("ts_uid") Integer ts_uid, @Param("t3_context") String t3_context);

}
